/*
  This file is part of 'Trivial chess'.

  'Trivial chess' is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  'Trivial chess' is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with 'Trivial chess'.  If not, see <http://www.gnu.org/licenses/>.
*/

/* SVN FILE: $Id$ */
/**
 * @author         $Author$
 * @version        $Rev$
 * @lastrevision   $Date$
 * @filesource     $URL$
 */

#ifndef BOARD8x8_H_
#define BOARD8x8_H_

#include <boost/cstdint.hpp>

#include "BoardAbstract.h"
#include "BoardCommon.h"

template<class S, class M, class CA, class Int = int16_t>
class Board8x8
	: public BoardAbstract<Board8x8<S,M,CA>,S,M,CA,Int>
	, public BoardCommon<typename M::Color,CA,S,Int> {
public:

	Board8x8<S,M,CA,Int>() {}
	explicit Board8x8<S,M,CA,Int>(const std::string str) { this->me().fromStr(str); }

	Man operator[](const Square square) const {
		return Man(this->board[square.rank().toInt()][square.file().toInt()]);
	}

	void set(const Square square, const Man man) {
		this->board[square.rank().toInt()][square.file().toInt()] = Man(man);
	}

	void unset(const Square square) {
		this->board[square.rank().toInt()][square.file().toInt()] = Man::NIL();
	}
private:
	Man board[8][8];
};

#endif /* BOARD8x8_H_ */
